package com.aiyan.edu.service.learning.controller;

import com.aiyan.edu.service.learning.client.HelloSearchClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author: zqzhou
 * @create: 2019/12/02 12:31
 **/
@RestController
@RefreshScope
@RequestMapping("/learning/hello")
public class LearningHelloController {

    @Autowired
    HelloSearchClient helloSearchClient;

    @Value("${aiyanedu.hello:empty}")
    String helloConfig;

    @Value("${spring.application.name}")
    String appName;

    @GetMapping("/search")
    public String searchData() {

        return helloSearchClient.data(appName + " : " + helloConfig);
    }
}
